package com.hyts.mvc.config;

import com.hyts.scanner.utility.StringUtils;

/**
 * project-name:coffice-toolbox
 * package-name:com.hyts.mvc.config
 * author:Libo/Alex
 * create-date:2019-06-18 19:57
 * copyright:libo-hyts-github
 * email:libo2dev@aliyun.com
 * description:此类主要用于: 请求方法
 */
public enum RequestMethod {

    ALL,
    //get请求
    GET,
    //POST请求
    POST,
    //head请求
    HEAD,
    //option请求
    OPTION,
    //DELETE请求
    DELETE,
    //PUT请求
    PUT;

    /**
     * ignore upperLower Case
     * @param methodName
     * @return
     */
    public static RequestMethod switchRequestMethod(String methodName){
        if(StringUtils.isNotEmpty(methodName)){
            for(RequestMethod requestMethod:RequestMethod.values()){
                if(requestMethod.name().equalsIgnoreCase(methodName)){
                    return requestMethod;
                }
            }
        }
        return RequestMethod.ALL;
    }
}
